package Day13;

import java.io.*;

/**
 * @Author kalista
 * @Description 缓冲字符流
 * @Date 2020/11/19  15:46
 **/
public class TestBufferCoye2 {
    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        FileReader fileInputStream = new FileReader("f:\\p.txt");
        FileWriter fileOutputStream = new FileWriter("f:\\p2.txt");
        BufferedReader in = new BufferedReader(fileInputStream);
        BufferedWriter bw = new BufferedWriter(fileOutputStream);
        String str = "";
        while ((str = in.readLine()) != null) {
            bw.write(str);
            // 在写入的换一行
            bw.newLine();
        }
        in.close();
        bw.close();
        fileOutputStream.close();
        fileInputStream.close();
        long end = System.currentTimeMillis();
        System.out.println(end-start);

//        long start = System.currentTimeMillis();
//        FileReader fileInputStream = new FileReader("f:\\p.txt");
//        FileWriter fileOutputStream = new FileWriter("f:\\p2.txt");
//
//        int tmp = 0;
//        while ((tmp = fileInputStream.read()) != -1) {
//            fileOutputStream.write(tmp);
//
//        }
//        fileOutputStream.close();
//        fileInputStream.close();
//        long end = System.currentTimeMillis();
//        System.out.println(end-start);
    }

}
